package com.dgt.trade.utils;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
/**
 * 
 * @ClassName: BizException 
 * @Description: 配置404 500 頁面
 * @author  
 * @date 2018年4月6日 下午8:43:38 
 *
 */
@ControllerAdvice
public class BizException {

    @ExceptionHandler({ RuntimeException.class })
    @ResponseStatus(HttpStatus.NOT_FOUND)
    public ModelAndView processException(RuntimeException exception) {
        ModelAndView m = new ModelAndView();
        m.addObject("exception", exception.getMessage());
        m.setViewName("error/404");
        return m;
 
    }
}
